package com.canin.admin.interceptor;

import java.util.Map;

import com.canin.Constant;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AdminInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = -7155013680303801776L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {

		Map<String, Object> session = invocation.getInvocationContext()
				.getSession();

		if (session.get(Constant.ADMIN) == null) {

			return "loginRedirect";
		}
		return invocation.invoke();
	}

}
